package com.jk;

import com.jk.util.MyInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/* *
 * @author rnn
 * @date 2018/4/12 9:19
 */
//加载spring环境 扫描(本包及子包)spring注解 读取app核心配置文件
//@EnableTransactionManagement//事务管理

@ImportResource("classpath:dubbo_customer.xml")
@SpringBootApplication
public class testStart {


    public static void main(String[] args) throws Exception {
        //springboot启动命令
        SpringApplication.run(testStart.class, args);
    }
    @Configuration
    static class WebMvcConfigurer extends WebMvcConfigurerAdapter {
        //增加拦截器
        public void addInterceptors(InterceptorRegistry registry){
            registry.addInterceptor(new MyInterceptor())    //指定拦截器类
                    .addPathPatterns("/**");        //指定该类拦截的url

        }
    }

}
